﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace park.ListSensor
{
    public partial class ListSensorAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string method = Request.Params["method"];
                if (!string.IsNullOrEmpty(method))
                {
                    PrintResult();
                }
            }
        }


        private void PrintResult()
        {

            #region 正式代码
            string strCode = Request.Params["code"];
            string strMeteredCoding = Request.Params["meteredCoding"];
            string strParkingNo = Request.Params["parkingNo"];
            string strModel = Request.Params["model"];
            string strInstalltime = Request.Params["installtime"];
            string strDescription = Request.Params["description"];

            cn.linkit.epark.ServiceList sl = new cn.linkit.epark.ServiceList();
            bool result = sl.AddSensor(strCode, strMeteredCoding, strParkingNo, strModel, strInstalltime, strDescription);
            if (result)
            {
                Response.Write("添加成功");
                Response.End();
            }
            else
            {
                Response.Write("添加失败");
                Response.End();
            }

            #endregion

            #region 测试代码
            //bool result =true;
            //if (result)
            //{
            //    Response.Write("添加成功");
            //    Response.End();
            //}
            //else
            //{
            //    Response.Write("添加失败");
            //    Response.End();
            //}
            #endregion

        }
    }
}